package com.khyr.controller;

import com.khyr.Service.OrderForGoodsService;
import com.khyr.vo.GetRegistrationByStatusOrderQueryVO;
import com.khyr.vo.OrderDetailsVo;
import com.khyr.vo.QMyPageDto;
import com.khyr.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：lyk
 * @date ：Created in 2025/3/17 19:08
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/charge/orderForGoods")
public class OrderForGoodsController {
    @Autowired
    private OrderForGoodsService orderForGoodsService;
    @GetMapping("/getRegistrationByStatus")
    public R<QMyPageDto> getRegistrationByStatus(GetRegistrationByStatusOrderQueryVO getRegistrationByStatusOrderQueryVO){
        QMyPageDto registrationByStatus = orderForGoodsService.getRegistrationByStatus(getRegistrationByStatusOrderQueryVO);
        if (registrationByStatus!=null){
            return new R<>(200,"查询成功",registrationByStatus);
        }else {
            return new R<>(500,"查询失败",null);
        }
    }
    @GetMapping("/getMemberOrderDetails/{chId}/{orderState}")
    public R<OrderDetailsVo> getMemberOrderDetails(@PathVariable String chId,@PathVariable Integer orderState){
        OrderDetailsVo memberOrderDetails = orderForGoodsService.getMemberOrderDetails(chId, orderState);
        if (memberOrderDetails!=null){
            return new R<>(200,"查询成功",memberOrderDetails);
        }else {
            return new R<>(500,"查询失败",null);
        }

    }
}
